-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds ability for user to define additional tags for images #1388
base: main
Are you sure you want to change the base?
Conversation
4b0b4ee
to
9b4264e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @fcaroline2020! The implementation looks good to me. Just a couple of small remarks and the lint issues to address
cmd/build.go
Outdated
@@ -54,6 +54,15 @@ func NewBuildCmd(flags *flags.GlobalFlags) *cobra.Command { | |||
} | |||
} | |||
|
|||
// validate tags | |||
if cmd.Tag != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmd.Tag is initialised as []string{} so won't be nil, I think it would be better to check len(cmd.Tag) > 0
pkg/devcontainer/prebuild.go
Outdated
@@ -87,10 +87,27 @@ func (r *runner) Build(ctx context.Context, options provider.BuildOptions) (stri | |||
) | |||
} | |||
|
|||
// Setup all image tags (prebuild and any user defined tags) | |||
ImageRefs := []string{prebuildImage} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: imageRefs over ImageRefs
pkg/devcontainer/prebuild.go
Outdated
|
||
// tag the image | ||
for _, imageRef := range ImageRefs { | ||
err = dockerDriver.TagDevContainer(ctx, prebuildImage, imageRef) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to check err is not nil or log here
pkg/devcontainer/prebuild.go
Outdated
if err != nil { | ||
return "", errors.Wrap(err, "push image") | ||
for _, imageRef := range ImageRefs { | ||
err = dockerDriver.PushDevContainer(ctx, imageRef) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this could be a one liner with err check
Adds new build cli flag
tag
that will tag the image with the user defined tag and then pushExample CLI command
./devpod-cli build . --devcontainer-path ./devcontainer.json --force-build --debug --tag test,arm64